package com.casic.modules.sys.controller;


import com.casic.common.base.entity.PageEntity;
import com.casic.common.utils.R;
import com.casic.modules.sys.entity.SysLogEntity;
import com.casic.modules.sys.entity.SysUserEntity;
import com.casic.modules.sys.service.SysLogService;
import com.casic.common.utils.PageUtils;
import com.casic.common.utils.Query;
import com.github.pagehelper.PageHelper;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;


/**
 * 系统日志
 * 
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2017-03-08 10:40:56
 */
@Controller
@RequestMapping("/sys/log")
public class SysLogController {
	@Autowired
	private SysLogService sysLogService;
	
	/**
	 * 列表
	 */
	@ResponseBody
	@RequestMapping("/list")
	public R list(@RequestParam Map<String, Object> params){
		int currentPage=1;
		int pageSize=10;
		if(params.get("page")!=null){
			currentPage=Integer.parseInt((String)params.get("page"));
		}
		if(params.get("limit")!=null){
			pageSize=Integer.parseInt((String)params.get("limit"));
		}
		PageHelper.startPage(currentPage, pageSize);
		List<SysLogEntity> list=sysLogService.queryList(params);
		return R.ok().put("page", new PageEntity<SysLogEntity>(list));
	}
	
}
